--[[
    更多游戏入口，点击进入游戏大厅界面
    1、开放大厅的游戏不需要显示
    2、没满足指定条件的玩家不显示
]]

local blaze = require "blaze"
local app = require "app"
local gamelib = require "club.threecard.gamelib"

local M = gamelib.ui.element()

function M:on_set_gameobject()
    self:super("on_set_gameobject")
    self.loaded = true
end

function M:on_injected(bind)
    bind("button.click", self.button, self.on_click)
    app.utility.button_style.highlight(self.button)
    if not app.entry.entry_game then
        -- 不锁游戏就不需要显示更多游戏了
        self:hide()
    end
end

function M:on_click()
    blaze.analytics.custom_event("more_games", {
        package = app.game.running.package
    })
    app.entry.entry_game = nil
    app.game.exit()
end

return M